package cn.iocoder.yudao.module.ai.service.busimodelparam;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import cn.iocoder.yudao.module.ai.controller.admin.busimodelparam.vo.*;
import cn.iocoder.yudao.module.ai.dal.dataobject.busimodelparam.BusiModelParamDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;

import cn.iocoder.yudao.module.ai.dal.mysql.busimodelparam.BusiModelParamMapper;

import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;

/**
 * 业务模型参数 Service 实现类
 *
 * @author gt
 */
@Service
@Validated
public class BusiModelParamServiceImpl implements BusiModelParamService {

    @Resource
    private BusiModelParamMapper busiModelParamMapper;

    @Override
    public Integer createBusiModelParam(BusiModelParamSaveReqVO createReqVO) {
        // 插入
        BusiModelParamDO busiModelParam = BeanUtils.toBean(createReqVO, BusiModelParamDO.class);
        busiModelParamMapper.insert(busiModelParam);
        // 返回
        return busiModelParam.getId();
    }

    @Override
    public void updateBusiModelParam(BusiModelParamSaveReqVO updateReqVO) {
        // 更新
        BusiModelParamDO updateObj = BeanUtils.toBean(updateReqVO, BusiModelParamDO.class);
        busiModelParamMapper.updateById(updateObj);
    }

    @Override
    public void deleteBusiModelParam(Integer id) {
        // 删除
        busiModelParamMapper.deleteById(id);
    }

    @Override
    public BusiModelParamDO getBusiModelParam(Integer id) {
        return busiModelParamMapper.selectById(id);
    }

    @Override
    public PageResult<BusiModelParamDO> getBusiModelParamPage(BusiModelParamPageReqVO pageReqVO) {
        return busiModelParamMapper.selectPage(pageReqVO);
    }

}